package modelo;

public class Calculator {
	
	private int upperLimit;
	private int lowerLimit;

	public Calculator(int minValue, int maxValue) {
		this.lowerLimit = minValue;
		this.upperLimit = maxValue;
		
	}

	public int add(int arg1, int arg2) {
		this.validateArgs(arg1, arg2);
		int result = arg1 + arg2;
		if (result > this.getUpperLimit()) throw new OverflowException();
		return result;
	}

	public int substract(int arg1, int arg2) {
		this.validateArgs(arg1, arg2);
		int result = arg1 - arg2;
		if (result < this.getLowerLimit()) throw new OverflowException();
		return result;
	}

	public int getUpperLimit() {
		return this.upperLimit;
	}
	
	public int getLowerLimit(){
		return this.lowerLimit;
	}
	

	


}
